﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GalaSoft.MvvmLight;

namespace MSSQL.DBSync.UI.Components.VOS
{
    public class ConnObjVO : ObservableObject
    {
        private string mUser;
        /// <summary>
        /// 名称
        /// </summary>
        public string User
        {
            get => mUser;
            set => Set(ref mUser, value);
        }


        private string mHost;
        /// <summary>
        /// 名称
        /// </summary>
        public string Host
        {
            get => mHost;
            set => Set(ref mHost, value);
        }


        private string mDB;
        /// <summary>
        /// 名称
        /// </summary>
        public string DB
        {
            get => mDB;
            set => Set(ref mDB, value);
        }


        private string mPWD;
        /// <summary>
        /// 名称
        /// </summary>
        public string PWD
        {
            get => mPWD;
            set => Set(ref mPWD, value);
        }


        /// <summary>
        /// 名称
        /// </summary>
        public string Id
        {
            get;
            set;
        }



        /// <summary>
        /// 检查连接
        /// </summary>
        /// <returns></returns>
        public string SelfCheck()
        {
            if (string.IsNullOrWhiteSpace(User))
            {
                return "User 不能为空";
            }

            if (string.IsNullOrWhiteSpace(Host))
            {
                return "Host 不能为空";
            }

            if (string.IsNullOrWhiteSpace(PWD))
            {
                return "PWD 不能为空";
            }

            return string.Empty;
        }
    }
}
